﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using _18miljard.TextLinks;

namespace _18miljard.UI.Controls
{
	public partial class TextLinksControl : BaseUserControl
	{
		protected override void PreLoadHandler(object sender, EventArgs e)
		{
			this.DisplayLinks();
		}

		private void DisplayLinks()
		{
			TextLinkCollection links = TextLinkCache.TextLinks.TextLinks;

			if (links.Count == 0)
			{
				this.Visible = false;

				return;
			}

			foreach (TextLink textLink in links)
			{
				this.Sponsorlist.Controls.Add(textLink.CreateWebControl());
			}
		}
	}
}